
public class Test {
    //Student类 只有一个
    public static void main(String[] args) {
        Class<?> a;

        try {
            a = Class.forName("Student");
            System.out.println(Student.class.getName());
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

        Class<?> b;
        b = Student.class;

        Student student = new Student();
        Class<?> c = student.getClass();

        //a,b,c的值相同
    }
}
class Solution {
    public int candy(int[] ratings) {
        int sum = 0;
        int[] ans = new int[ratings.length];
        for(int i=0; i<ratings.length; i++){
            if(i>0 && ratings[i]>ratings[i-1]){
                ans[i] = ans[i-1]+1;
            }else{
                ans[i] = 1;
            }
        }
        for(int i=ratings.length-1; i>=0; i--){
            if(i<ratings.length-1 && ratings[i]>ratings[i+1]){
                ans[i] = Math.max(ans[i],ans[i+1]+1);
            }else{
                ans[i] = Math.max(1,ans[i]);
            }
            sum += ans[i];
        }
        return sum;
    }
}